class Solution {
public:
    int countWords(vector<string>& words1, vector<string>& words2) {
        map<string, int>mp1, mp2;
        for (auto x : words1) {
            mp1[x]++;
        }
        for (auto x : words2) {
            mp2[x]++;
        }
        int ans = 0;
        for (auto x : words1) {
            if (mp1[x] == 1 && mp2[x] == 1)ans++;
        }
        return ans;
    }
};